﻿package Engine.RMI
{
    import Engine.flash.*;
    import Framework.Serialize.*;
    import Framework.Util.*;

    public class RMIObject extends EventSender
    {
        protected var _response:Function;
        protected var _ex:Function;
        private var _identity:SIdentity;
        private var _callFunction:String;
        private var _usedTimer:Number;
        public var userObject:Object;

        public function RMIObject(param1:Function = null, param2:Function = null)
        {
            this._response = param1;
            this._ex = param2;
            return;
        }// end function

        public function __dispatch(param1:Context, param2:SRMICall, param3:SerializeStream, param4:SerializeStream) : ERMIDispatchStatus
        {
            return ERMIDispatchStatus.DispatchOK;
        }// end function

        public function __response(param1:SerializeStream) : void
        {
            return;
        }// end function

        public function cdeException(param1:Exception) : void
        {
            if (this._ex != null)
            {
                this._ex.call(this, param1);
                return;
            }
            param1.method = "";
            if (this._identity)
            {
                param1.method = this._identity.name + ":";
            }
            else
            {
                trace("method:" + param1.method + " callFunction:" + this._callFunction);
            }
            param1.method = param1.method + this._callFunction;
            RMIDispatcher.getInstance().dispatchErrorEvent(param1);
            return;
        }// end function

        public function get identity() : SIdentity
        {
            return this._identity;
        }// end function

        public function set identity(param1:SIdentity) : void
        {
            if (this._identity == null)
            {
                this._identity = new SIdentity();
            }
            this._identity.name = param1.name;
            return;
        }// end function

        public function set name(param1:String) : void
        {
            if (this._identity == null)
            {
                this._identity = new SIdentity();
            }
            this._identity.name = param1;
            return;
        }// end function

        public function get name() : String
        {
            if (this._identity)
            {
                return this._identity.name;
            }
            return null;
        }// end function

        public function set callFunction(param1:String) : void
        {
            this._callFunction = param1;
            return;
        }// end function

        public function get usedTimer() : Number
        {
            return this._usedTimer;
        }// end function

        public function set usedTimer(param1:Number) : void
        {
            this._usedTimer = param1;
            return;
        }// end function

        public function get callFunction() : String
        {
            return this._callFunction;
        }// end function

    }
}
